package com.home.jinlanhua.utils;

import java.util.HashMap;

public class BeginingUtil {

    public static void main(String[] args) {
        HashMap<String, String> map = new HashMap<>();
        map.put("a","b");
        System.out.println(map.toString().substring(1));
    }

    public static String changeNameFromJavaToMysql(String s) {
        return s.replaceAll("([A-Z])", "_$1").toLowerCase();
    }

    public static String changeNameFromMysqlToJava(String s) {
        if (!s.contains("_"))
            return s;
        char[] ch = s.toCharArray();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < s.length(); i++) {
            if (ch[i] == '_') {
                ch[i + 1] -= 32;
                sb.append(ch[i + 1]);
                i++;
            } else {
                sb.append(ch[i]);
            }
        }
        return sb.toString();
    }

}
